package com.example.toutiao.ui.main.presenter


import com.example.toutiao.http.HttpUtils
import com.example.toutiao.http.ResponseListener
import com.example.toutiao.http.UserApi
import com.example.toutiao.mvp.model.BaseModel
import com.example.toutiao.mvp.presenter.BasePresenter
import com.example.toutiao.ui.main.model.RecMainModel
import com.example.toutiao.ui.main.model.RecommenModel
import com.example.toutiao.ui.main.view.SearchView

class SearchPresenter: BasePresenter<SearchView>() {
    fun getSearchHis(){
        HttpUtils.sendHttp(HttpUtils.createApi(UserApi::class.java).getSearchHis(),object :
            ResponseListener<BaseModel<RecMainModel>> {
            override fun onSuccess(data: BaseModel<RecMainModel>) {
                if(data!=null&&data.code==200){
                    getBaseView()!!.setData(data.data)
                }
            }
            override fun onFail(err: String) {
                getBaseView()!!.setError(err)
            }
        })
    }
}